package org.jeecg.modules.gwcjava.jiekou.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.ParameterModule.entity.AddSystemPriceInfo;
import org.jeecg.modules.alipay.bo.PaymentBO;
import org.jeecg.modules.gwcjava.jiekou.entity.*;
import org.jeecg.modules.gwcjava.jiekou.mapper.BusinessLogicMapper;
import org.jeecg.modules.gwcjava.jiekou.service.BusinessLogicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.interceptor.TransactionAspectSupport;

import java.util.Date;
import java.util.List;

@Service
public class BusinessLogicServiceImpl extends ServiceImpl<BusinessLogicMapper, MlccLookingInfo> implements BusinessLogicService {
    @Autowired
    private BusinessLogicMapper logicMapper;

    /**产品求购*/
    @Override
    public int add_looking(String userId,String looking_title, String looking_detail, String imgs, Date create_time) {
        try {
            logicMapper.add_looking(userId,looking_title, looking_detail,imgs,create_time);
            return 1;
        } catch (Exception e) {
            // TODO: handle exception
            System.out.println("新增失败"+e);
            return 0;
        }
    }
    /**查询导航栏模块*/
    @Override
    public List<ModelInfo> query_module() {
        List<ModelInfo> detail = logicMapper.query_module();
        return detail;
    }
    /**根据公司id查询所有门店*/
    @Override
    public List<StoreInfo> query_storeinfo(String companyId,int type) {
        List<StoreInfo> detail = logicMapper.query_storeinfo(companyId,type);
        return detail;
    }
    /**根据门店编码查询门店信息*/
    @Override
    public StoreInfo query_storeDetailBycode(String storeCode) {
        StoreInfo storeInfo = logicMapper.query_storeDetailBycode(storeCode);
        return storeInfo;
    }
    /**根据门店编码查询门店的常用地址*/
    @Override
    public List<StoreInfo> query_storeAddressBycode(String storeCode) {
        List<StoreInfo> detail = logicMapper.query_storeAddressBycode(storeCode);
        return detail;
    }
    //根据地址id查询地址详情
    @Override
    public StoreInfo query_nomladdressByid(String address_id) {
        StoreInfo storeInfo = logicMapper.query_nomladdressByid(address_id);
        return storeInfo;
    }

    /**根据传入的类型查询不同的数据*/
    @Override
    public List<DataTypeInfo> query_dataBytype(String type) {
        List<DataTypeInfo> datalist = logicMapper.query_dataBytype(type);
        return datalist;
    }
    /**查询所有快递*/
    @Override
    public List<CourierInfo> query_AllCourier() {
        List<CourierInfo> datalist = logicMapper.query_AllCourier();
        return datalist;
    }
    /**根据导航栏id和类别id查询模块名称*/
    @Override
    public List<ModuleSmalltemplateInfo> query_SmalltemplateInfo(String moduleId, String category_id) {
        List<ModuleSmalltemplateInfo> datalist = logicMapper.query_SmalltemplateInfo(moduleId,category_id);
        return datalist;
    }
    /**根据模块id查询类别*/
    @Override
    public List<CategoryInfo> query_categoryInfo(String templateId,String category_id) {
        List<CategoryInfo> datalist = logicMapper.query_categoryInfo(templateId,category_id);
        return datalist;
    }
    /**查询所有绣字字体*/
    @Override
    public List<EmbroideredFontInfo> query_AllembroiderFont(String category_ids,int type) {
        List<EmbroideredFontInfo> datalist = logicMapper.query_AllembroiderFont(category_ids,type);
        return datalist;
    }
    /**查询所有绣字颜色*/
    @Override
    public List<EmbroideredColorInfo> query_AllembroiderColor(String category_ids) {
        List<EmbroideredColorInfo> datalist = logicMapper.query_AllembroiderColor(category_ids);
        return datalist;
    }
    /**查询所有撞色*/
    @Override
    public List<ContrastcolorInfo> query_AllContrastcolorInfo(String category_id,String category_ids) {
        List<ContrastcolorInfo> datalist = logicMapper.query_AllContrastcolorInfo(category_id,category_ids);
        return datalist;
    }
    /**修改撞色的色值*/
    @Override
    public int update_Contrastcolor(String id, String color_id) {
        try {
            logicMapper.update_Contrastcolor(id,color_id);
            return 1;
        } catch (Exception e) {
            // TODO: handle exception
            System.out.println("修改失败"+e);
            return 0;
        }
    }
    /**添加撞色记录表*/
    @Override
    public int add_ContrastcolorRedcord(String zhuangse_id, String color_id, String user_id, String category_ids,String product_id) {
        try {
            logicMapper.add_ContrastcolorRedcord(zhuangse_id,color_id,user_id,category_ids,product_id);
            return 1;
        } catch (Exception e) {
            // TODO: handle exception
            System.out.println("添加失败"+e);
            return 0;
        }
    }
    /**根据撞色id类别ids用户id修改撞色记录*/
    @Override
    public int update_ContrastcolorRedcord(String color_id, String zhuangse_id, String user_id, String category_ids,String product_id) {
        try {
            logicMapper.update_ContrastcolorRedcord(color_id,zhuangse_id,user_id,category_ids,product_id);
            return 1;
        } catch (Exception e) {
            // TODO: handle exception
            System.out.println("修改失败"+e);
            return 0;
        }
    }
    /**根据撞色id和颜色id类别ids用户id查询*/
    @Override
    public ZhuangseRedcordInfo query_zhuangseRedcordById(String zhuangse_id, String user_id, String category_ids,String product_id) {
        ZhuangseRedcordInfo datainfo = logicMapper.query_zhuangseRedcordById(zhuangse_id,user_id,category_ids,product_id);
        return datainfo;
    }

    /**根据查询模块id和类别id查询身体数据*/
    @Override
    public List<BodySizeInfo> query_bodySizeinfo(String template_id, String category_id,String is_jin) {
        List<BodySizeInfo> datalist = logicMapper.query_bodySizeinfo(template_id,category_id,is_jin);
        return datalist;
    }
    /**根据查询模块id和类别id查询身体部位数据*/
    @Override
    public List<SizeInfo> query_sizeInfo(String template_id, String category_id) {
        List<SizeInfo> datalist = logicMapper.query_sizeInfo(template_id,category_id);
        return datalist;
    }
    @Override
    public List<SizeInfo1> query_sizeInfo1(String sizeId) {
        List<SizeInfo1> datalist = logicMapper.query_sizeInfo1(sizeId);
        return datalist;
    }

    /**增加个订模板*/
    @Override
    public int add_templateInfo(TemplateRecordInfo templateInfo) {
        try {
            logicMapper.add_templateInfo(templateInfo);
            return 1;
        } catch (Exception e) {
            // TODO: handle exception
            System.out.println("添加模板失败"+e);
            return 0;
        }
    }
    /**更新编辑个订模板*/
    @Override
    public int update_single_templateInfo(TemplateRecordInfo templateInfo) {
        try {
            logicMapper.update_single_templateInfo(templateInfo);
            return 1;
        } catch (Exception e) {
            // TODO: handle exception
            System.out.println("更新模板失败"+e);
            return 0;
        }
    }

    /**根据类别id查询类别详情*/
    @Override
    public CategoryInfo query_categoryDetailInfo(String category_id) {
        CategoryInfo detailinfo = logicMapper.query_categoryDetailInfo(category_id);
        return detailinfo;
    }
    /**查询我的模板产品列表*/
    @Override
    public IPage<TemplateRecordInfo> query_templateInfoByuserid(Page<TemplateRecordInfo> page, String user_id) {
        IPage<TemplateRecordInfo> pagelist = logicMapper.query_templateInfoByuserid(page,user_id);
        return pagelist;
    }
    /**生成个订订单*/
    @Override
    public int add_signOrderInfo(SingleOrderInfo templateInfo) {
        try {
            logicMapper.add_signOrderInfo(templateInfo);
            return 1;
        } catch (Exception e) {
            // TODO: handle exception
            System.out.println("添加订单失败"+e);
            return 0;
        }
    }
    /**根据订单号查询订单*/
    @Override
    public SingleOrderInfo query_signorder(String order_sn) {
        SingleOrderInfo detailinfo = logicMapper.query_signorder(order_sn);
        return detailinfo;
    }
    /**根据模板编号号查询模板*/
    @Override
    public TemplateRecordInfo query_templateRecordInfo(String order_sn) {
        TemplateRecordInfo detailinfo = logicMapper.query_templateRecordInfo(order_sn);
        return detailinfo;
    }

    /**增加订单尺寸表关系*/
    @Override
    public int add_Order_sizeInfo(String order_id, String bodysize_id, String sizevalue,String is_order, Date create_time) {
        try {
            logicMapper.add_Order_sizeInfo(order_id,bodysize_id,sizevalue,is_order,create_time);
            return 1;
        } catch (Exception e) {
            // TODO: handle exception
            System.out.println("添加订单尺寸表失败"+e);
            return 0;
        }
    }
    /**根据类别id查询位置*/
    @Override
    public List<CategoryLocaltion> query_localtionInfo(String category_id) {
        List<CategoryLocaltion> datalist = logicMapper.query_localtionInfo(category_id);
        return datalist;
    }
    /**根据用户id查询订单*/
    @Override
    public IPage<TemplateRecordInfo> query_orderinfoByuserId(Page<TemplateRecordInfo> page, String user_id) {
        IPage<TemplateRecordInfo> pagelist = logicMapper.query_orderinfoByuserId(page,user_id);
        return pagelist;
    }
    /**根据用户id查询模板*/
    @Override
    public IPage<TemplateRecordInfo> query_signmoduleinfo(Page<TemplateRecordInfo> page, String user_id, int type) {
        IPage<TemplateRecordInfo> pagelist = logicMapper.query_signmoduleinfo(page,user_id,type);
        return pagelist;
    }
    /**根据用户id查询订单2*/
    @Override
    public IPage<SingleOrderInfo> query_orderinfoByuserId2(Page<SingleOrderInfo> page, String user_id,String queryTime,String queryName) {
        IPage<SingleOrderInfo> pagelist = logicMapper.query_orderinfoByuserId2(page,user_id,queryTime,queryName);
        return pagelist;
    }
    /**根据面料id查询面料详情*/
    @Override
    public FabricInfo query_fabricDetailInfo(String fabric_id) {
        FabricInfo detailinfo = logicMapper.query_fabricDetailInfo(fabric_id);
        return detailinfo;
    }
    /**根据纽扣id查询纽扣详情*/
    @Override
    public ButtonsInfo query_buttonsInfo(String buttons_id) {
        ButtonsInfo detailinfo = logicMapper.query_buttonsInfo(buttons_id);
        return detailinfo;
    }
    /**根据绣字类型id查询绣字类型详情*/
    @Override
    public EmbroideredTypePriceInfo query_emPriceinfo(String emid) {
        EmbroideredTypePriceInfo detailinfo = logicMapper.query_emPriceinfo(emid);
        return detailinfo;
    }

    /**根据用户id和订单号修改状态*/
    @Override
    public int update_status(String order_sn,int type) {
        try {
            logicMapper.update_status(order_sn,type);
            return 1;
        } catch (Exception e) {
            // TODO: handle exception
            System.out.println("修改失败"+e);
            return 0;
        }
    }
    /**根据订单号更新订单*/
    @Override
    public int update_single_order(SingleOrderInfo orderInfo) {
        try {
            logicMapper.update_single_order(orderInfo);
            return 1;
        } catch (Exception e) {
            // TODO: handle exception
            System.out.println("更新失败"+e);
            return 0;
        }
    }
    /**添加产品*/
    @Override
    public int insert_products(ProductInfo productInfo) {
        try {
            logicMapper.insert_products(productInfo);
            return 1;
        } catch (Exception e) {
            // TODO: handle exception
            System.out.println("添加失败"+e);
            return 0;
        }
    }
    /**添加产品到部门*/
    @Override
    public int insert_products_todepart(String productId, String departId, Date creaTime) {
        try {
            logicMapper.insert_products_todepart(productId,departId,creaTime);
            return 1;
        } catch (Exception e) {
            // TODO: handle exception
            System.out.println("添加失败"+e);
            return 0;
        }
    }

    /**编辑产品*/
    @Override
    public int update_products(ProductInfo productInfo) {
        try {
            logicMapper.update_products(productInfo);
            return 1;
        } catch (Exception e) {
            // TODO: handle exception
            System.out.println("更新失败"+e);
            return 0;
        }
    }
    /**根据订单号查询产品列表*/
    @Override
    public List<ProductInfo> query_productInfoByorderSn(String user_id, String order_sn) {
        List<ProductInfo> datalist = logicMapper.query_productInfoByorderSn(user_id,order_sn);
        return datalist;
    }
    /**根据模板编号查询产品列表*/
    @Override
    public List<ProductInfo> query_productInfoBytemplateSn(String user_id, String template_sn) {
        List<ProductInfo> datalist = logicMapper.query_productInfoBytemplateSn(user_id,template_sn);
        return datalist;
    }

    /**创建团订订单*/
    @Override
    public int insert_team_order(TeamOrderInfo teamOrderInfo) {
        try {
            logicMapper.insert_team_order(teamOrderInfo);
            return 1;
        } catch (Exception e) {
            // TODO: handle exception
            System.out.println("失败"+e);
            return 0;
        }
    }
    /**创建团订模板*/
    @Override
    public int insert_team_template(TeamTemplateInfo templateInfo) {
        try {
            logicMapper.insert_team_template(templateInfo);
            return 1;
        } catch (Exception e) {
            // TODO: handle exception
            System.out.println("失败"+e);
            return 0;
        }
    }
    /**更新团订订单*/
    @Override
    public int update_team_order(TeamOrderInfo teamOrderInfo) {
        try {
            logicMapper.update_team_order(teamOrderInfo);
            return 1;
        } catch (Exception e) {
            // TODO: handle exception
            System.out.println("失败"+e);
            return 0;
        }
    }
    /**创建团订模板*/
    @Override
    public int update_team_template(TeamTemplateInfo templateInfo) {
        try {
            logicMapper.update_team_template(templateInfo);
            return 1;
        } catch (Exception e) {
            // TODO: handle exception
            System.out.println("失败"+e);
            return 0;
        }
    }
    /**查询订单基本信息*/
    @Override
    public TeamOrderInfo queryOrderDetail(String orderSn) {
        TeamOrderInfo datainfo = logicMapper.queryteamOrderDetail(orderSn);
        return datainfo;
    }

    /**根据用户id和type查询团队模板和订单表*/
    @Override
    public IPage<TeamTemplateInfo> query_teamTemplateInfo(Page<TeamTemplateInfo> page, String user_id,String orgcode, int type) {
        IPage<TeamTemplateInfo> pagelist = logicMapper.query_teamTemplateInfo(page,user_id,orgcode,type);
        return pagelist;
    }
    /**根据模板编号查询模板详情*/
    @Override
    public TeamTemplateInfo query_teamTemplateDetailInfo(String order_sn) {
        TeamTemplateInfo datainfo = logicMapper.query_teamTemplateDetailInfo(order_sn);
        return datainfo;
    }
    /**根据产品id查询产品详情*/
    @Override
    public ProductInfo query_productDetail(String product_id) {
        ProductInfo datainfo = logicMapper.query_productDetail(product_id);
        return datainfo;
    }
    /**根据用户id查询业务流水表*/
    @Override
    public List<BusinessWaterInfo> query_businesswaterInfo(String user_id,String StartTime,String endTime) {
        List<BusinessWaterInfo> datalist = logicMapper.query_businesswaterInfo(user_id,StartTime,endTime);
        return datalist;
    }
    /**统计*/
    @Override
    public List<BusinessWaterInfo> count_businesswaterInfo(String creatime,String user_id) {
        List<BusinessWaterInfo> datalist = logicMapper.count_businesswaterInfo(creatime,user_id);
        return datalist;
    }
    /**统计*/
    @Override
    public BusinessWaterInfo queryOrderMoney(String id, int type) {
        BusinessWaterInfo datainfo = logicMapper.queryOrderMoney(id,type);
        return datainfo;
    }
    /**根据条件查询业务流水表*/
    @Override
    public List<BusinessWaterInfo> query_businesswater_today(String user_id, String addtime) {
        List<BusinessWaterInfo> datalist = logicMapper.query_businesswater_today(user_id,addtime);
        return datalist;
    }

    @Override
    public List<BodySizeInfo> query_bodySizeinfo_productid(String productId, String bodysizeId, String bodysizeVaule) {
        List<BodySizeInfo> datalist = logicMapper.query_bodySizeinfo_productid(productId,bodysizeId,bodysizeVaule);
        return datalist;
    }
    /**根据条件查询业务流水表*/
    @Override
    public IPage<BusinessWaterInfo> query_yewu_waterInfo(Page<BusinessWaterInfo> page, String user_id, int type) {
        IPage<BusinessWaterInfo> datalist = logicMapper.query_yewu_waterInfo(page,user_id,type);
        return datalist;
    }

    @Override
    public SmallProductInfo query_smallProductInfo(String teamOrderSn, String productId, String customerId) {
        SmallProductInfo datainfo = logicMapper.query_smallProductInfo(teamOrderSn,productId,customerId);
        return datainfo;
    }
    //创建团订下的小产品
    @Override
    public int insert_teamOrder_products(SmallProductInfo dataInfo) {
        try {
            logicMapper.insert_teamOrder_products(dataInfo);
            return 1;
        } catch (Exception e) {
            // TODO: handle exception
            System.out.println("失败"+e);
            return 0;
        }
    }
    //修改团订下的小产品
    @Override
    public int update_teamOrder_products(SmallProductInfo dataInfo) {
        try {
            logicMapper.update_teamOrder_products(dataInfo);
            return 1;
        } catch (Exception e) {
            // TODO: handle exception
            System.out.println("失败"+e);
            return 0;
        }
    }
    //添加小产品尺寸表
    @Override
    public int insert_smallproduct_bodysizes(String team_order_sn, String customer_product_id, String bodysize_id, String bodysize_value) {
        try {
            logicMapper.insert_smallproduct_bodysizes(team_order_sn,customer_product_id,bodysize_id,bodysize_value);
            return 1;
        } catch (Exception e) {
            // TODO: handle exception
            System.out.println("失败"+e);
            return 0;
        }
    }
    //修改小产品尺寸表
    @Override
    public int update_smallproduct_bodysizes(String team_order_sn, String customer_product_id, String bodysize_id, String bodysize_value,int status) {
        try {
            logicMapper.update_smallproduct_bodysizes(team_order_sn,customer_product_id,bodysize_id,bodysize_value,status);
            return 1;
        } catch (Exception e) {
            // TODO: handle exception
            System.out.println("失败"+e);
            return 0;
        }
    }

    //根据订单编号查询和类型查询订单详情
    @Override
    public PaymentBO query_paymentBODetail(String order_sn, String type) {
        PaymentBO datainfo = logicMapper.query_paymentBODetail(order_sn,type);
        return datainfo;
    }
    //根据团订下的客户id和客户编码查询客户信息
    @Override
    public CustomerInfo queryCostomerDtailById(String customerId, String code) {
        CustomerInfo datainfo = logicMapper.queryCostomerDtailById(customerId,code);
        return datainfo;
    }
    //根据部门id查询部门下的产品
    @Override
    public List<ProductInfo> query_allproductBydepartId(String departId,String sex) {
        List<ProductInfo> datalist = logicMapper.query_allproductBydepartId(departId,sex);
        return datalist;
    }

    //删除部门下的产品
    @Override
    public int delete_depart_product(String id,String product_id) {
        try {
            logicMapper.delete_depart_product(id);
            //执行删除小产品数据根据大产品id
            logicMapper.delete_liangti_byproductId(product_id);
            return 1;
        } catch (Exception e) {
            // TODO: handle exception
            System.out.println("失败"+e);
            return 0;
        }
    }
    //根据客户id查询量体信息
    @Override
    public IPage<CustomerInfo> query_customer_liangti(Page<CustomerInfo> page, String partmentId, String queryName, int is_liangti) {
        IPage<CustomerInfo> datalist = logicMapper.query_customer_liangti(page,partmentId,queryName,is_liangti);
        return datalist;
    }
    //根据团订下的客户id查询客户信息（这里是公司身份）
    @Override
    public CustomerInfo queryCostomerInfoById(String customerId) {
        CustomerInfo datalist = logicMapper.queryCostomerInfoById(customerId);
        return datalist;
    }
    //查询我的消息
    @Override
    public List<MessageDataInfo2> query_mymessage(String queryName, String is_read,String user_id) {
        List<MessageDataInfo2> datalist = logicMapper.query_mymessage(queryName,is_read,user_id);
        return datalist;
    }
    //查询详细详情
    @Override
    public MessageDataInfo2 query_messageDetail(String msg_id) {
        MessageDataInfo2 datalist = logicMapper.query_messageDetail(msg_id);
        return datalist;
    }

    @Override
    public int add_readed_message(String message_id, String sys_user_id, String userType) {
        try {
            logicMapper.add_readed_message(message_id,sys_user_id,userType);
            return 1;
        } catch (Exception e) {
            // TODO: handle exception
            System.out.println("失败"+e);
            return 0;
        }
    }

    @Override
    public MessageDataInfo2 query_read_messageDetail(String message_id, String sys_user_id) {
        MessageDataInfo2 datalist = logicMapper.query_read_messageDetail(message_id,sys_user_id);
        return datalist;
    }
    //价格体系
    @Override
    public PriceSystemPinleiInfo query_pricesysytemDetail(String category_id, String bussiness_type, String is_gognyi) {
        PriceSystemPinleiInfo datainfo = logicMapper.query_pricesysytemDetail(category_id,bussiness_type,is_gognyi);
        return datainfo;
    }
    //价格区间
    @Override
    public List<PriceSystemQujianInfo> query_pricequjian(String system_price_id) {
        List<PriceSystemQujianInfo> datalist = logicMapper.query_pricequjian(system_price_id);
        return datalist;
    }

    //根据类别查询绣字高度
    @Override
    public List<EmbroideredTypePriceInfo> query_xiuziHeightInfo(String category_id,String xiuzi_type) {
        List<EmbroideredTypePriceInfo> datalist = logicMapper.query_xiuziHeightInfo(category_id,xiuzi_type);
        return datalist;
    }
    //根据品类id查询系统加急项
    @Override
    public List<AddSystemPriceInfo> query_system_priceInfo(String category_id, String type) {
        List<AddSystemPriceInfo> datalist = logicMapper.query_system_priceInfo(category_id,type);
        return datalist;
    }
    //根据品类id查询系统加急项--上级
    @Override
    public List<PriceTopSystemInfo> query_system_ToppriceInfo(String category_id) {
        List<PriceTopSystemInfo> datalist = logicMapper.query_system_ToppriceInfo(category_id);
        return datalist;
    }

    //根据品类id和业务类型id查询价格体系记录
    @Override
    public MlccPriceSystemPinglei2 query_pricepinglei(String category_id, String type, String is_gongyi) {
        MlccPriceSystemPinglei2 datainfo = logicMapper.query_pricepinglei(category_id,type,is_gongyi);
        return datainfo;
    }
    //根据品类id，价格体系id，参数id查询具体的成本记录
    @Override
    public MlccPriceSystemCostRecord query_pricepinglei_CostRecord(String category_id, String price_id, String canshu_id) {
        MlccPriceSystemCostRecord datainfo = logicMapper.query_pricepinglei_CostRecord(category_id,price_id,canshu_id);
        return datainfo;
    }
    //根据用户id查询团订订单列表
    @Override
    public IPage<TeamOrderInfo> query_teamOrderInfo(Page<TeamOrderInfo> page, String user_id, String queryTime,String queryName) {
        IPage<TeamOrderInfo> pagelist = logicMapper.query_teamOrderInfo(page,user_id,queryTime,queryName);
        return pagelist;
    }
    //根据用户id查询个订订单列表
    @Override
    public IPage<SingleOrderInfo> query_singleOrderInfo(Page<SingleOrderInfo> page, String user_id, String queryTime,String queryName) {
        IPage<SingleOrderInfo> pagelist = logicMapper.query_singleOrderInfo(page,user_id,queryTime,queryName);
        return pagelist;
    }
    //查询辅料
    @Override
    public List<CategoryMaterialInfo> query_alllibuListBycategoryId(String category_id, String type) {
        List<CategoryMaterialInfo> datalist = logicMapper.query_alllibuListBycategoryId(category_id,type);
        return datalist;
    }
    //查询辅料+分页
    @Override
    public IPage<CategoryMaterialInfo> query_MaterialInfopageList(Page<CategoryMaterialInfo> page, String category_id, String type, String code,String buttontype) {
        IPage<CategoryMaterialInfo> pagelist = logicMapper.query_MaterialInfopageList(page,category_id,type,code,buttontype);
        return pagelist;
    }
    //根据版号id查询绣字图片或者字体--分页
    @Override
    public IPage<EmbroideredFontInfo> query_xiuziImgpageList(Page<EmbroideredFontInfo> page, String category_id, String type, String code) {
        IPage<EmbroideredFontInfo> pagelist = logicMapper.query_xiuziImgpageList(page,category_id,type,code);
        return pagelist;
    }
    //根据版号id查询绣字颜色--分页
    @Override
    public IPage<EmbroideredColorInfo> query_xiuziColorpageList(Page<EmbroideredColorInfo> page, String category_id, String code) {
        IPage<EmbroideredColorInfo> pagelist = logicMapper.query_xiuziColorpageList(page,category_id,code);
        return pagelist;
    }
    //根据里布id查询里布/低领里详情
    @Override
    public CategoryMaterialInfo query_materialInfo(String metarmail_id, int type) {
        CategoryMaterialInfo datainfo = logicMapper.query_materialInfo(metarmail_id,type);
        return datainfo;
    }
    //查询协议详情
    @Override
    public AgreementInfo query_userXieyiDetail(String msg_id, String type) {
        AgreementInfo datainfo = logicMapper.query_userXieyiDetail(msg_id,type);
        return datainfo;
    }

    //编辑产品名称
    @Override
    public int update_only_productsName(String id, String name) {
        try {
            logicMapper.update_only_productsName(id,name);
            return 1;
        } catch (Exception e) {
            // TODO: handle exception
            System.out.println("失败"+e);
            return 0;
        }
    }
    //删除小产品
    @Override
    public int delete_small_product(String id) {
        try {
            logicMapper.delete_small_product(id);
            return 1;
        } catch (Exception e) {
            // TODO: handle exception
            System.out.println("失败"+e);
            return 0;
        }
    }
    //根据客户id，大产品id，订单编号查询小产品详情
    @Override
    public SmallProductInfo query_smallproductInfoByType(String customerId, String productId, String orderSn) {
        SmallProductInfo datainfo = logicMapper.query_smallproductInfoByType(customerId,productId,orderSn);
        return datainfo;
    }
    //根据尺寸id查询尺寸详情
    @Override
    public BodySizeInfo query_bodySizeInfoByid(String bodysizeId) {
        BodySizeInfo datainfo = logicMapper.query_bodySizeInfoByid(bodysizeId);
        return datainfo;
    }
    //删除产品尺寸
    @Override
    public int delete_product_bodysize(String product_id) {
        try {
            logicMapper.delete_product_bodysize(product_id);
            return 1;
        } catch (Exception e) {
            // TODO: handle exception
            System.out.println("失败"+e);
            return 0;
        }
    }

    @Override
    public CategoryMaterialInfo query_materialDetail(String metarmail_id, String plate_id, int type) {
        CategoryMaterialInfo datainfo = logicMapper.query_materialDetail(metarmail_id,plate_id,type);
        return datainfo;
    }
    //根据品类id查询所有撞色
    @Override
    public List<ContrastcolorInfo> query_AllContrastInfoByCategoryId(String category_id) {
        List<ContrastcolorInfo> datalist = logicMapper.query_AllContrastInfoByCategoryId(category_id);
        return datalist;
    }

    @Override
    public ContrastcolorInfo queryContrasDetail(String category_id, String id) {
        ContrastcolorInfo datainfo = logicMapper.queryContrasDetail(category_id,id);
        return datainfo;
    }

    @Override
    public List<BodySizeInfo> query_bodySizeinfoByplateId(String category_id) {
        List<BodySizeInfo> datalist = logicMapper.query_bodySizeinfoByplateId(category_id);
        return datalist;
    }
    //根据版号id查询下面所有的定制项参数
    @Override
    public List<CategoryInfo> query_categorylistByplateId(String plateId) {
        List<CategoryInfo> datalist = logicMapper.query_categorylistByplateId(plateId);
        return datalist;
    }

    @Override
    public CustomerInfo query_customerDetailByid(String customerId,int type) {
        CustomerInfo datainfo = logicMapper.query_customerDetailByid(customerId,type);
        return datainfo;
    }

    @Override
    public List<CustomerDepartInfo> query_cusdepartList(String customerId) {
        List<CustomerDepartInfo> datalist = logicMapper.query_cusdepartList(customerId);
        return datalist;
    }

    @Override
    public List<CustomerInfo> query_customerlistByparentId(String customerId) {
        List<CustomerInfo> datalist = logicMapper.query_customerlistByparentId(customerId);
        return datalist;
    }

    @Override
    public List<ProductInfo> query_productBydepartId(String departId) {
        List<ProductInfo> datalist = logicMapper.query_productBydepartId(departId);
        return datalist;
    }

    @Override
    public CustomerDepartInfo query_CustomerDepartDetailByid(String departId, int type) {
        CustomerDepartInfo datainfo = logicMapper.query_CustomerDepartDetailByid(departId,type);
        return datainfo;
    }

    @Override
    public int add_newcustomer(CustomerInfo testinfo) {
        try {
            logicMapper.add_newcustomer(testinfo);
            return 1;
        } catch (Exception e) {
            // TODO: handle exception
            System.out.println("失败"+e);
            return 0;
        }
    }

    @Override
    public int add_newcustomer_depart(CustomerDepartInfo testinfo) {
        try {
            logicMapper.add_newcustomer_depart(testinfo);
            return 1;
        } catch (Exception e) {
            // TODO: handle exception
            System.out.println("失败"+e);
            return 0;
        }
    }

    @Override
    public int add_newdepart_product(String product_id, String depart_id, String remark) {
        try {
            logicMapper.add_newdepart_product(product_id,depart_id,remark);
            return 1;
        } catch (Exception e) {
            // TODO: handle exception
            System.out.println("失败"+e);
            return 0;
        }
    }

    @Override
    public List<RefundMoneyInfo> query_RefundMoneyInfo(String company_user_id) {
        List<RefundMoneyInfo> refundMoneyInfoList = logicMapper.query_RefundMoneyInfo(company_user_id);
        return refundMoneyInfoList;
    }

    //根据订单编号和类型修改订单状态
    @Override
    public int change_order_status(String orderSn, int type,int applymethod) {
        try {
            logicMapper.change_order_status(orderSn,type,applymethod);
            return 1;
        } catch (Exception e) {
            // TODO: handle exception
            System.out.println("失败"+e);
            return 0;
        }
    }
    //插入流水表
    @Override
    public int insert_into_water(BusinessWaterInfo object) {
        try {
            logicMapper.insert_into_water(object);
            return 1;
        } catch (Exception e) {
            // TODO: handle exception
            System.out.println("失败"+e);
            return 0;
        }
    }
    //插入订单跟踪表
    @Override
    public int insert_into_ordertracking(String id, String order_sn, String order_type, String remark, String thing, int order_status) {
        try {
            logicMapper.insert_into_ordertracking(id,order_sn,order_type,remark,thing,order_status);
            return 1;
        } catch (Exception e) {
            // TODO: handle exception
            System.out.println("失败"+e);
            return 0;
        }
    }
    //插入订单事件表
    @Override
    public int insert_into_orderevent(String id, String event_name, int type, String order_sn, String order_type, String remark) {
        try {
            logicMapper.insert_into_orderevent(id,event_name,type,order_sn,order_type,remark);
            return 1;
        } catch (Exception e) {
            // TODO: handle exception
            System.out.println("失败"+e);
            return 0;
        }
    }
    //根据面料订单编号查询面料详情
    @Override
    public FabricOrderInfo query_fabricOrderDetailBycode(String order_sn) {
        FabricOrderInfo datainfo = logicMapper.query_fabricOrderDetailBycode(order_sn);
        return datainfo;
    }

    @Override
    public int add_wxorderinfo(WxOrderStatus testinfo) {
        try {
            logicMapper.add_wxorderinfo(testinfo);
            return 1;
        } catch (Exception e) {
            // TODO: handle exception
            System.out.println("失败"+e);
            return 0;
        }
    }

    @Override
    public WxOrderStatus query_WxOrderStatusDetailBysn(String outTradeNo) {
        WxOrderStatus datainfo = logicMapper.query_WxOrderStatusDetailBysn(outTradeNo);
        return datainfo;
    }

    @Override
    public int update_wxorder_status(String id, String status) {
        try {
            logicMapper.update_wxorder_status(id,status);
            return 1;
        } catch (Exception e) {
            // TODO: handle exception
            System.out.println("失败"+e);
            return 0;
        }
    }
    //根据上级品类id和编号查询类别详情
    @Override
    public CategoryInfo query_categoryDetailBytop_id(String top_id, String code) {
        CategoryInfo datainfo = logicMapper.query_categoryDetailBytop_id(top_id,code);
        return datainfo;
    }

    @Override
    public int update_single_order_products(String products, String orderSn) {
        try {
            logicMapper.update_single_order_products(products,orderSn);
            return 1;
        } catch (Exception e) {
            // TODO: handle exception
            System.out.println("失败"+e);
            return 0;
        }
    }

    @Override
    public int update_single_template_products(String products, String templateSn) {
        try {
            logicMapper.update_single_template_products(products,templateSn);
            return 1;
        } catch (Exception e) {
            // TODO: handle exception
            System.out.println("失败"+e);
            return 0;
        }
    }

    @Override
    public ThirdGoodsInfo query_goodsDetailByid(String goodsId) {
        ThirdGoodsInfo datainfo = logicMapper.query_goodsDetailByid(goodsId);
        return datainfo;
    }

    @Override
    public List<ThirdGoodsLadderPrice> query_rungpricedatalist(String series_id) {
        List<ThirdGoodsLadderPrice> datalist = logicMapper.query_rungpricedatalist(series_id);
        return datalist;
    }

    @Override
    public List<ThirdGoodsSpecifications> query_Specificationsdatalist(String goodsId) {
        List<ThirdGoodsSpecifications> datalist = logicMapper.query_Specificationsdatalist(goodsId);
        return datalist;
    }

    @Override
    public List<ThirdGoodParameter> query_Parameterdatalist(String goodsId) {
        List<ThirdGoodParameter> datalist = logicMapper.query_Parameterdatalist(goodsId);
        return datalist;
    }

    /**关于购物车系列*/
    @Override
    public int add_cart_goods(ThirdCartInfo datainfo) {
        try {
            logicMapper.add_cart_goods(datainfo);
            return 1;
        } catch (Exception e) {
            // TODO: handle exception
            System.out.println("失败"+e);
            //手动回滚事务
            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            return 0;
        }
    }

    @Override
    public int add_cart_goods_buynum(ThirdCartInfo datainfo) {
        try {
            logicMapper.add_cart_goods_buynum(datainfo);
            return 1;
        } catch (Exception e) {
            // TODO: handle exception
            System.out.println("失败"+e);
            //手动回滚事务
            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            return 0;
        }
    }

    @Override
    public ThirdCartInfo query_cartinfoBygoodId(String goods_id,String user_id) {
        ThirdCartInfo datainfo = logicMapper.query_cartinfoBygoodId(goods_id,user_id);
        return datainfo;
    }

    @Override
    public ThirdCartInfo query_cartinfobuyNum_BygoodId(String goods_id, String guige_id, String size_id,String user_id) {
        ThirdCartInfo datainfo = logicMapper.query_cartinfobuyNum_BygoodId(goods_id,guige_id,size_id,user_id);
        return datainfo;
    }

    @Override
    public int update_cart_goods_buynum(String id, String nownum) {
        try {
            logicMapper.update_cart_goods_buynum(id,nownum);
            return 1;
        } catch (Exception e) {
            // TODO: handle exception
            System.out.println("失败"+e);
            return 0;
        }
    }

    @Override
    public int update_cart_goods(String id, String nownum,String money) {
        try {
            logicMapper.update_cart_goods(id,nownum,money);
            return 1;
        } catch (Exception e) {
            // TODO: handle exception
            System.out.println("失败"+e);
            return 0;
        }
    }

}
